import { createRouter, createWebHistory } from 'vue-router'
import Layout from '../layout/index.vue'


const routes = [
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/Login.vue')
  },
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: '',
        name: 'Dashboard',
        component: () => import('../views/dashboard/index.vue'),
        meta: { title: '首页' }
      }
    ]
  },
  {
    path: '/room-type',
    component: Layout,
    children: [
      {
        path: '',
        name: 'RoomType',
        component: () => import('../views/room-type/index.vue'),
        meta: { title: '客房类型管理' }
      }
    ]
  },
  {
    path: '/room-order',
    component: Layout,
    children: [
      {
        path: '',
        name: 'RoomOrder',
        component: () => import('../views/room-order/index.vue'),
        meta: { title: '客房订单管理' }
      }
    ]
  },
  {
    path: '/checkout',
    component: Layout,
    children: [
      {
        path: '',
        name: 'Checkout',
        component: () => import('../views/checkout/index.vue'),
        meta: { title: '退房订单管理' }
      }
    ]
  },
  {
    path: '/user',
    component: Layout,
    children: [
      {
        path: '',
        name: 'User',
        component: () => import('../views/user/index.vue'),
        meta: { title: '用户管理' }
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router